﻿#!/usr/bin/env python
#coding:utf-8
from probe.core.level import *
from commands import *
def servicestatus(args):
    '''监控服务进程'''
    result = getstatusoutput('ps -ef|grep -w %s|grep -v grep'%args.get('Service'))
    if result[0] != 0:
        return WarningData({'服务进程%s'%args.get('Service'): [int(result[0]), '不存在']})
    return InfoData({'服务进程%s'%args.get('Service'): [int(result[0]), '不存在']})

if __name__ == '__main__':
    print servicestatus({'Service': 'gameserver'})
